<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>添加记录</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      margin: 0;
      padding: 0;
    }
    .container {
      width: 500px;
      margin: 50px auto;
      background: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }
    h2 {
      text-align: center;
      color: #333;
    }
    form {
      display: flex;
      flex-direction: column;
    }
    label {
      margin-top: 10px;
      font-weight: bold;
    }
    input[type="text"],
    textarea {
      padding: 10px;
      margin-top: 5px;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    .btn-add {
      background-color: #4CAF50;
      color: white;
      padding: 10px 20px;
      margin-top: 20px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.3s;
    }
    .btn-add:hover {
      background-color: #45a049;
    }
  </style>
</head>
<body>
<jsp:include page="/nav.jsp"/>
<div class="container">
  <h2>添加记录</h2>
  <form action="absenceAdd2" method="post">
    <label for="date">日期:</label>
    <input type="date" id="date" name="date" required>

    <label for="userId">学生ID:</label>
    <input type="text" id="userId" name="userId" required>

    <label for="name">姓名:</label>
    <input type="text" id="name" name="name" required>

    <label for="gender">性别:</label>
    <input type="text" id="gender" name="gender" required>

    <label for="building">宿舍楼:</label>
    <select id="building" name="building" required>
      <c:forEach var="building" items="${requestScope.buildings}">
        <option value="${building.buildingCard}">${building.buildingCard}</option>
      </c:forEach>
      <!-- 选项将从数据库中动态生成 -->
    </select>

    <label for="room">寝室:</label>
    <input type="text" id="room" name="room" required>

    <input type="submit" value="添加" class="btn-add">
  </form>
</div>
</body>
</html>